<template>
  <div class="detail-wrapper">
    <div class="top">
      <el-form
        class="data-form"
        ref="formRef"
        inline
        :model="form"
        :rules="rules"
        label-width="120px"
        label-position="left"
      >
        <!-- 巡检计划信息 -->
        <div class="title">巡检计划信息</div>
        <el-row>
          <el-col :span="8">
            <el-form-item label="巡检计划名称" prop="name">
              <el-input
                class="data-input2"
                v-model="form.name"
                placeholder="请输入"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="巡检园区" prop="areaId">
              <el-select
                class="data-input2"
                v-model="form.areaId"
                placeholder="请选择"
                multiple
              >
                <el-option
                  v-for="(item, index) of parkOptions"
                  :key="index"
                  :label="item.name"
                  :value="item.pkid"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <!-- 编辑时不可修改检查类型 -->
          <el-col :span="8">
            <el-form-item label="检查类型" prop="typeId">
              <el-select
                class="data-input2"
                v-model="form.typeId"
                placeholder="请选择"
                :disabled="!!form.pkid"
                @change="handleChangeTypeId"
              >
                <el-option
                  v-for="(item, index) of dict['inspection_inspection_type']"
                  :key="index"
                  :label="item.name"
                  :disabled="isReview ? item.value !== '4' : item.value === '4'"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col v-if="form.typeId === '2' && isAdmin()" :span="8">
            <el-form-item
              label="是否园区覆盖"
              prop="covered"
              v-if="form.typeId === '2'"
            >
              <el-radio-group v-model="form.covered">
                <el-radio
                  v-for="(item, index) of dict['yn']"
                  :key="index"
                  :value="item.value"
                  >{{ item.name }}</el-radio
                >
              </el-radio-group>
              <el-tooltip
                effect="dark"
                content="为否，只要检查了一个检查项，巡检任务就默认已完成"
                placement="top-start"
              >
                <el-icon class="tips"><QuestionFilled /></el-icon>
              </el-tooltip>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="计划开始日期" prop="planBeginTime">
              <el-date-picker
                class="data-input2"
                v-model="form.planBeginTime"
                type="date"
                value-format="YYYY-MM-DD"
                placeholder="请选择"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="计划结束日期" prop="planEndTime">
              <el-date-picker
                :disabled="!form.planBeginTime"
                class="data-input2"
                v-model="form.planEndTime"
                type="date"
                value-format="YYYY-MM-DD"
                placeholder="请选择"
                :disabled-date="disabledDate"
              />
            </el-form-item>
          </el-col>
          <el-col v-if="form.typeId === '3'" :span="8">
            <el-form-item label="计划类型" prop="periodType">
              <el-radio-group
                v-model="form.periodType"
                :disabled="['0', '1', '2', '5'].includes(form.typeId)"
              >
                <el-radio
                  v-for="(item, index) of dict['inspection_plan_type']"
                  :key="index"
                  :value="item.value"
                  >{{ item.name }}</el-radio
                >
              </el-radio-group>
            </el-form-item>
          </el-col>
          <!-- 计划类型-天 || 专项-天 -->
          <template v-if="form.typeId === '3' && form.periodType === '0'">
            <el-col :span="8">
              <el-form-item
                label="执行间隔"
                class="inline-form-item"
                prop="periodInterval"
              >
                <span>每</span>
                <el-input
                  class="data-input1"
                  v-model="form.periodInterval"
                  placeholder="请输入"
                ></el-input>
                <span>天</span>
              </el-form-item>
            </el-col>
          </template>
          <!-- 计划类型-周 -->
          <template v-if="form.typeId === '3' && form.periodType === '1'">
            <el-col :span="8">
              <el-form-item
                label="执行间隔"
                class="inline-form-item"
                prop="periodInterval"
              >
                <span>每</span>
                <el-input
                  class="data-input1"
                  max-length="3"
                  v-model.number="form.periodInterval"
                  placeholder="请输入"
                ></el-input>
                <span>周</span>
              </el-form-item>
              <el-form-item
                label=""
                class="inline-form-item"
                prop="periodStart"
              >
                <span>从第</span>
                <el-input
                  class="data-input1"
                  max-length="3"
                  v-model.number="form.periodStart"
                  placeholder="请输入"
                ></el-input>
                <span>个工作日开始</span>
              </el-form-item>
            </el-col>
          </template>
          <!-- 计划类型-月 -->
          <template v-if="form.typeId === '3' && form.periodType == '2'">
            <el-col :span="8">
              <el-form-item
                label="执行间隔"
                class="inline-form-item"
                prop="periodInterval"
              >
                <span>每</span>
                <el-input
                  class="data-input1"
                  max-length="3"
                  v-model.number="form.periodInterval"
                  placeholder="请输入"
                ></el-input>
                <span>月</span>
              </el-form-item>
              <el-form-item
                label=""
                class="inline-form-item"
                prop="periodStart"
              >
                <span>从第</span>
                <el-input
                  class="data-input1"
                  max-length="3"
                  v-model.number="form.periodStart"
                  placeholder="请输入"
                ></el-input>
                <span>个工作日开始</span>
              </el-form-item>
            </el-col>
          </template>
          <el-col :span="8">
            <el-form-item label="备注" prop="remark">
              <el-input
                class="data-input2"
                type="textarea"
                v-model="form.remark"
                placeholder="请输入"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <!-- 巡检路线表 -->
        <div class="xjlxb wrapper" v-if="form.areaId.length > 0">
          <div class="title">
            巡检路线
            <el-button type="primary" @click="handleClickAddCheckingPoint"
              >添加检查点</el-button
            >
          </div>
          <Tabs
            @change="(val) => (currentComponentKey = val)"
            :currentKey="currentComponentKey"
            :tabsConfig="tabsConfig"
            :hasBorder="true"
          />
          <div class="body">
            <el-table
              class="table"
              :data="routeTableData[currentComponentKey]"
              stripe
            >
              <el-table-column type="index" label="序号" width="80" />
              <el-table-column prop="code" label="检查点编号" />
              <el-table-column prop="name" label="检查点名称" />
              <el-table-column prop="senceName" label="检查点场景" />
              <el-table-column prop="address" label="地理位置" />
              <el-table-column prop="imageFiles" label="检查点图片">
                <template #default="{ row }">
                  <el-image
                    class="image"
                    v-for="(item, index) in row.imageFiles"
                    :key="index"
                    :src="item.fileUrl"
                    fit="cover"
                    :preview-src-list="
                      row.imageFiles.map((i) => {
                        return i.fileUrl
                      })
                    "
                    preview-teleported
                    :initial-index="index"
                  />
                </template>
              </el-table-column>
              <el-table-column
                prop="tablesName"
                label="关联检查表"
                :show-overflow-tooltip="true"
              />
              <el-table-column label="操作" width="100">
                <template #default="{ row }">
                  <el-link
                    type="danger"
                    @click="handleClickDeleteCheckingPoint(row)"
                    >删除</el-link
                  >
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>

        <!-- 巡检人员 -->
        <div class="xjlxb wrapper" v-if="form.typeId">
          <div class="title">
            巡检人员
            <!-- 日检查：对应园区日检查类型人员，不可选择 -->
            <template v-if="form.typeId === '0'">
              <el-button
                type="primary"
                @click="handleAddUser({ checkType: '0', areaId: form.areaId })"
                >选择巡检人员</el-button
              >（园区对应巡检人员）
            </template>

            <!-- 周检查：资产分公司安监部周检查类型人员，不可选择 -->
            <template v-if="form.typeId === '1'">
              <el-button
                type="primary"
                @click="
                  handleAddUser({
                    areaId: ['1769649903898312705'],
                    checkType: '1',
                    patrolPost: ['6'],
                  })
                "
                >选择巡检人员</el-button
              >（资产分公司安监部人员）
            </template>

            <!-- 月检查：资产分公司月检查类型人员，可选择 -->
            <el-button
              v-if="form.typeId === '2'"
              type="primary"
              @click="
                handleAddUser({
                  areaId: ['1769649903898312705'],
                  checkType: '2',
                })
              "
              >选择巡检人员</el-button
            >
            <!-- 专项检查：资产分公司、四联投资、对应园区专项检查类型人员，可选择 -->
            <el-button
              v-if="form.typeId === '3'"
              type="primary"
              @click="
                handleAddUser({
                  areaId: [
                    '1769649903898312705',
                    '1769649761027735554',
                    ...form.areaId,
                  ],
                  checkType: '3',
                })
              "
              >选择巡检人员</el-button
            >
            <!-- 整改复查：资产分公司安监部整改复查类型人员，不可选择 -->
            <template v-if="form.typeId === '4'">
              <el-button
                type="primary"
                @click="
                  handleAddUser({
                    areaId: ['1769649903898312705'],
                    checkType: '4',
                    patrolPost: ['6'],
                  })
                "
                >选择巡检人员</el-button
              >（资产分公司安监部人员）
            </template>

            <!-- 节假日检查：排班表人员 -->
            <el-button
              v-if="form.typeId === '5'"
              type="primary"
              @click="router.push({ name: 'personSchedule' })"
              >排班人员</el-button
            >
          </div>
          <div v-show="userIds.length > 0" class="users">
            <!--            <div-->
            <!--              class="users-item"-->
            <!--              v-for="(item, index) of userIds"-->
            <!--              :key="index"-->
            <!--            >-->
            <!--              {{ item.userName }}-->
            <!--              <el-button type="danger" link @click="handleRemoveUser(index)"-->
            <!--                ><el-icon><CircleCloseFilled /></el-icon-->
            <!--              ></el-button>-->
            <!--            </div>-->
            <el-table :data="userIds" class="custom-table">
              <el-table-column label="序号" type="index" width="60px" />
              <el-table-column label="真实姓名" prop="userName" />
              <el-table-column label="联系方式" prop="userPhone" />
              <el-table-column label="所属园区" prop="areaName" />
              <el-table-column label="岗位" prop="userPhone">
                <template #default="scope">
                  {{
                    getDictValue('inspector_post_type', scope.row.patrolPost)
                  }}
                </template>
              </el-table-column>
              <el-table-column label="操作" width="100">
                <template #default="{ row }">
                  <el-link
                    type="danger"
                    @click="handleClickDeleteCheckingPerson(row)"
                    >删除</el-link
                  >
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
        <!-- 每天执行计划 -->
        <!-- 只有计划类型为天时才展示 -->
        <div
          class="mtzxjh wrapper"
          v-if="form.periodType === '0' && ['0', '5'].includes(form.typeId)"
        >
          <div class="title">
            每天执行计划
            <el-button type="primary" @click="handleClickAddCheckingPlan"
              >添加计划</el-button
            >
          </div>
          <div class="body">
            <el-form-item
              label="检查点分配"
              prop="assignType"
              v-if="
                ['0', '5'].includes(form.typeId) ||
                (form.typeId === '3' && form.periodType === '0')
              "
            >
              <el-radio-group
                v-model="form.assignType"
                @change="handleChangeAssginType"
              >
                <el-radio
                  v-for="(item, index) of dict[
                    'inspection_plan_point_allocation_type'
                  ]"
                  :key="index"
                  :value="item.value"
                  >{{ item.name }}</el-radio
                >
              </el-radio-group>
            </el-form-item>
            <el-row v-for="(item, index) in form.assignRules" :key="index">
              <el-col :span="6">
                <el-form-item
                  label="开始时间-结束时间"
                  class="inline-form-item1"
                  :prop="'assignRules.' + index + '.time'"
                  :rules="rules.time"
                >
                  <el-time-picker
                    class="data-input2"
                    v-model="item.time"
                    is-range
                    placeholder="选择时间范围"
                    value-format="HH:mm"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6" v-if="form.assignType === '1'">
                <el-form-item
                  label="检查点"
                  class="inline-form-item1"
                  :prop="'assignRules.' + index + '.pointIds'"
                  :rules="rules.pointIds"
                >
                  <el-select
                    class="data-input2"
                    multiple
                    v-model="item.pointIds"
                    placeholder="请选择"
                  >
                    <el-option
                      v-for="(item, index) of checkPointOptions"
                      :key="index"
                      :label="item.name"
                      :value="item.pkid"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-icon
                class="icon"
                @click="handleClickDeleteCheckingPlan(index)"
              >
                <Delete />
              </el-icon>
            </el-row>
          </div>
        </div>
      </el-form>
    </div>
    <div class="bottom">
      <el-button @click="handleClose" :loading="loading">取消</el-button>
      <el-button
        v-if="form.status !== '0'"
        @click="handleSubmit('-1')"
        :loading="loading"
        >保存</el-button
      >
      <el-button type="primary" @click="handleSubmit('0')" :loading="loading"
        >确定</el-button
      >
    </div>
    <RouteDialog
      ref="routeDialogRef"
      :areaId="currentComponentKey"
      @change="handleUpdateCheckingPoint"
    />
    <UserDialog ref="userDialogRef" @change="handleUpdateUser" />
  </div>
</template>
<script setup>
import { onMounted, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { Delete, QuestionFilled } from '@element-plus/icons-vue'
import { parkPageList } from '@/api/manager/dataManage/park'
import { getCheckPointList } from '@/api/manager/inspectionManage/checkPointManage.js'
import {
  addPlan,
  getPlanDetail,
  updatePlan,
} from '@/api/manager/inspectionManage/planManage.js'
import { ElMessage } from 'element-plus'
import RouteDialog from './components/routeDialog.vue'
import UserDialog from './components/userDialog.vue'
import { isAdmin } from '@/utils/role/index.js'
import Tabs from '@/components/tabs/index.vue'
import { useDict } from '@/hooks/useDict'

const { dict, getDictValue } = useDict([
  'inspection_inspection_type',
  'yn',
  'inspection_plan_type',
  'inspection_plan_point_allocation_type',
  'inspector_post_type',
])

const router = useRouter()
const route = useRoute()
const handleClose = () => {
  router.push({ name: 'planManage' })
}

const disabledDate = (time) => {
  const nowTime = Date.now() - 8.64e7
  if (form.value.planBeginTime) {
    const beginTime = new Date(form.value.planBeginTime) - 8.64e7
    if (beginTime > nowTime) {
      return time.getTime() < beginTime
    } else {
      return time.getTime() < nowTime
    }
  } else {
    return time.getTime() < nowTime
  }
}
// 巡检计划信息
const loading = ref(false)
const formRef = ref()
const form = ref({
  periodType: 1,
  periodInterval: 1,
  periodStart: 1,
  covered: '',
  areaId: [],
  assignRules: [
    {
      time: [],
      pointIds: [],
    },
  ],
})
const rules = ref({
  name: [{ required: true, message: '请输入巡检计划名称', trigger: 'blur' }],
  typeId: [{ required: true, message: '请选择巡检类型', trigger: 'blur' }],
  areaId: [{ required: true, message: '请选择巡检园区', trigger: 'blur' }],
  covered: [{ required: true, message: '请选择是否园区覆盖', trigger: 'blur' }],
  planBeginTime: [
    { required: true, message: '请选择计划开始日期', trigger: 'blur' },
  ],
  planEndTime: [
    { required: true, message: '请选择计划结束日期', trigger: 'blur' },
  ],
  periodType: [{ required: true, message: '请选择计划类型', trigger: 'blur' }],
  periodInterval: [
    { required: true, message: '请选择执行间隔', trigger: 'blur' },
  ],
  periodStart: [
    { required: true, message: '请选择从第几个工作日开始', trigger: 'blur' },
  ],
  assignType: [
    { required: true, message: '请选择检查点分配', trigger: 'blur' },
  ],
  time: [{ required: true, message: '请选择执行时间', trigger: 'blur' }],
  pointIds: [{ required: true, message: '请选择检查点', trigger: 'blur' }],
})

// 修改检查类型
// 日周月检查 => 计划类型分别为 日、周、月，不可修改
// 节假日检查 => 计划类型分别为 日，不可修改
// 专项检查 => 计划类型日周月自选
// 整改复查 => 无计划类型
const handleChangeTypeId = () => {
  form.value.periodInterval = '1'
  form.value.periodStart = '1'
  userIds.value = []
  if (form.value.typeId === '2') {
    form.value.covered = '1'
  } else {
    form.value.covered = ''
  }
  form.value.assignRules = [
    {
      time: [],
      pointIds: [],
    },
  ]
  if (['0', '1', '2'].includes(form.value.typeId)) {
    form.value.periodType = form.value.typeId
  } else if (form.value.typeId === '5') {
    form.value.periodType = '0'
  } else {
    form.value.periodType = ''
  }
}

const tabsConfig = ref([])
const currentComponentKey = ref('')
// 修改园区：重置巡检路线tabs和列表
const handleChangeAreaId = (isLoadRoute = true) => {
  const currentTabs = parkOptions.value.filter((i) =>
    form.value.areaId.includes(i.pkid),
  )
  currentTabs.map((i) => {
    i.value = i.pkid
  })
  tabsConfig.value = currentTabs
  currentComponentKey.value =
    tabsConfig.value.length > 0 ? tabsConfig.value[0].pkid : ''

  if (isLoadRoute) {
    getAllParkRoute()
  }
}
// 获取巡检路线检查点
const routeTableData = ref({})
const getAllParkRoute = async () => {
  if (form.value.areaId.length > 0) {
    for (let key in routeTableData.value) {
      if (!form.value.areaId.includes(key)) {
        delete routeTableData.value[key]
      }
    }
    form.value.areaId.forEach((item) => {
      if (!routeTableData.value[item]) {
        getCheckPointList({
          pageIndex: 1,
          pageSize: 9999,
          areaId: item,
        }).then((res) => {
          routeTableData.value[item] = res.data.list
        })
      }
    })
  } else {
    routeTableData.value = {}
  }
}

const userIds = ref([])
const userDialogRef = ref()
const handleAddUser = (params, isShowOperate = true) => {
  userDialogRef.value.dialogVisible = true
  userDialogRef.value.isShowOperate = isShowOperate
  userDialogRef.value.multipleSelection = JSON.parse(
    JSON.stringify(userIds.value),
  )
  userDialogRef.value.searchParams = {
    ...userDialogRef.value.searchParams,
    ...params,
  }
}
const handleUpdateUser = (val) => {
  userIds.value = val
}
const handleRemoveUser = (index) => {
  userIds.value.splice(index, 1)
}

// 修改计划分配方式
const handleChangeAssginType = () => {
  form.value.assignRules.forEach((item) => {
    item.pointIds = []
  })
}

// 点击删除检查点
const handleClickDeleteCheckingPoint = (row) => {
  const deleteIndex = routeTableData.value[currentComponentKey.value].findIndex(
    (i) => i.pkid === row.pkid,
  )
  routeTableData.value[currentComponentKey.value].splice(deleteIndex, 1)
}

const handleClickDeleteCheckingPerson = (row) => {
  const deleteIndex = userIds.value.findIndex((i) => i.pkid === row.pkid)
  userIds.value.splice(deleteIndex, 1)
}

// 点击添加检查点
const routeDialogRef = ref()
const handleClickAddCheckingPoint = () => {
  routeDialogRef.value.dialogVisible = true
  if (routeTableData.value[currentComponentKey.value]) {
    routeDialogRef.value.multipleSelection = JSON.parse(
      JSON.stringify(routeTableData.value[currentComponentKey.value]),
    )
  } else {
    routeDialogRef.value.multipleSelection = []
  }
}
// 确定选择的检查点
const handleUpdateCheckingPoint = (val) => {
  routeTableData.value[currentComponentKey.value] = val
}

const checkPointOptions = ref([])
watch(
  () => routeTableData.value,
  () => {
    let arr = []
    for (let key in routeTableData.value) {
      arr = arr.concat(routeTableData.value[key])
    }
    checkPointOptions.value = arr
  },
  {
    deep: true,
    immediate: true,
  },
)

watch(
  () => form.value.areaId,
  (val, oldVal) => {
    if (val.length > 1) {
      // 移除前面的元素，只保留最后一个
      // ElMessage.warning('巡检园区只能选择1个')
      form.value.areaId = [val[val.length - 1]]
    }
    handleChangeAreaId(val)
  },
  {
    deep: true,
  },
)

// 点击添加执行计划
const handleClickAddCheckingPlan = () => {
  form.value.assignRules.push({
    time: [],
    pointIds: [],
  })
}
// 点击删除执行计划
const handleClickDeleteCheckingPlan = (index) => {
  form.value.assignRules.splice(index, 1)
}

// 获取详情
const handleDetail = async () => {
  const res = await getPlanDetail({ pkid: route.query.pkid })
  // 处理巡检园区
  const areaId = []
  res.data.areaIds.forEach((item) => {
    areaId.push(item.areaId)
    const pointIds = []
    item.pointIds.forEach((point) => {
      pointIds.push({
        address: point.address,
        imageFiles: point.imageFiles,
        code: point.pointCode,
        pkid: point.pointId,
        name: point.pointName,
        position: point.position,
        senceName: point.senceName,
        tablesName: point.tableName,
      })
    })
    routeTableData.value[item.areaId] = pointIds
  })
  res.data.areaId = areaId
  // 处理巡检人员
  if (['0', '1', '2', '3', '4'].includes(res.data.typeId)) {
    const userIdsArr = []
    const userId = res.data.areaIds[0].userIds
    const userName = res.data.areaIds[0].userName.split(',')
    for (let i = 0; i < userId.length; ++i) {
      userIdsArr.push({ pkid: userId[i], userName: userName[i] })
    }
    userIds.value = userIdsArr
  }
  delete res.data.areaIds
  // 处理每天执行计划
  if (res.data.periodType === '0') {
    res.data.assignRules.forEach((item) => {
      item.time = [item.startTime, item.endTime]
      delete item.startTime
      delete item.endTime
    })
  }
  form.value = { ...res.data }
  handleChangeAreaId(false)
}

// 提交
const handleSubmit = (status) => {
  if (!formRef.value) return
  formRef.value.validate(async (valid, fields) => {
    if (valid) {
      try {
        if (
          ['0', '1', '2', '3', '4'].includes(form.value.typeId) &&
          userIds.value === 0
        ) {
          ElMessage.warning('请选择巡检人员')
          return
        }
        const params = JSON.parse(JSON.stringify(form.value))
        loading.value = true
        // 处理状态
        params.status = status
        // 处理每天执行计划
        if (params.periodType === '0') {
          if (params.assignRules.length === 0) {
            ElMessage.warning('至少一个每天执行开始/结束时间')
            return
          } else {
            params.assignRules.forEach((item) => {
              item.startTime = item.time[0]
              item.endTime = item.time[1]
              delete item.time
            })
          }
        }
        if (form.value.typeId === '4') {
          params.repairIds = route.query.repairIds?.split(',') || []
        }
        // 处理巡检路线
        const areaIds = []
        for (let key in routeTableData.value) {
          const area = {
            areaId: key,
            userIds: [],
            pointIds: [],
          }
          routeTableData.value[key].forEach((item) => {
            area.pointIds.push({ pointId: item.pkid })
          })
          areaIds.push(area)
          area.userIds = userIds.value.map((i) => {
            return i.pkid
          })
        }
        params.areaIds = areaIds
        delete params.areaId
        try {
          let res
          if (!params.pkid) {
            res = await addPlan(params)
          } else {
            res = await updatePlan(params)
          }
          if (res.success) {
            ElMessage.success('保存成功')
            handleClose()
          } else {
            ElMessage.error(res.message)
          }
          loading.value = false
        } catch (error) {
          loading.value = false
        }
        loading.value = false
      } catch (error) {
        console.log('error', error)
      }
    } else {
      ElMessage.warning('请正确录入信息')
    }
  })
}

// 获取园区列表
const parkOptions = ref([])
const initParkOptions = async () => {
  const res = await parkPageList({
    pageIndex: 1,
    pageSize: 9999,
    enable: '1',
  })
  parkOptions.value = res.data.list
  handleChangeAreaId(false)
}

const isReview = route.query.review === '1'

onMounted(() => {
  initParkOptions()
  if (route.query.pkid) {
    handleDetail()
  }
})
</script>
<style lang="scss" scoped>
:deep(.el-form-item) {
  width: 100%;
}
:deep(.data-input2) {
  width: 280px !important;
}
:deep(.data-input1) {
  width: 50px !important;
  margin: 0 10px;
}
:deep(.inline-form-item) {
  width: 220px !important;
  margin-right: 10px;
  span {
    color: #606266;
  }
}
:deep(.inline-form-item1) {
  .el-form-item__label {
    width: 145px !important;
    justify-content: flex-end;
  }
}
.detail-wrapper {
  width: 100%;
  height: 100%;
  background: #ffffff;
  box-shadow: 0px 0px 10px 0px rgba(72, 121, 238, 0.1);
  box-sizing: border-box;
  padding-top: 20px;
  .top {
    width: 100%;
    height: calc(100% - 70px);
    box-sizing: border-box;
    padding: 0 20px 20px 20px;
    overflow-y: scroll;

    &::-webkit-scrollbar {
      display: none;
    }

    .title {
      font-size: 16px;
      font-weight: 500;
      color: #151515;
      position: relative;
      padding-left: 10px;
      margin-bottom: 20px;
      display: flex;
      align-items: center;

      &::before {
        content: ' ';
        position: absolute;
        left: 0;
        top: 50%;
        width: 4px;
        height: 16px;
        background: linear-gradient(0deg, #4575ee 0%, #6297f5 100%);
        border-radius: 2px;
        transform: translateY(-50%);
      }
      .el-button {
        margin-left: 10px;
      }
    }
    .el-row {
      width: 100%;
      overflow: hidden;
    }
    .tabs-wrapper {
      box-shadow: none;
      padding: 0;
      margin-bottom: 20px;
    }
    .table {
      margin-bottom: 30px;
      .image {
        margin-right: 5px;
        cursor: pointer;
        width: 40px;
        height: 40px;
      }
    }

    .mtzxjh {
      .check-points {
        display: flex;

        .check-point {
          margin-right: 10px;
        }
      }

      .icon {
        margin-left: 10px;
        margin-top: 10px;
        color: red;
        cursor: pointer;
        font-size: 18px;
      }
    }
    .tips {
      margin-left: 10px;
      opacity: 0.5;
    }
    .users {
      width: 100%;
      box-sizing: border-box;
      padding: 0 10px;
      display: flex;
      flex-wrap: wrap;
      margin-bottom: 20px;
      &-item {
        background-color: #ecf5ff;
        border-radius: 4px;
        color: #409eff;
        font-size: 14px;
        font-weight: 400;
        padding: 0px 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 10px;
        margin-bottom: 10px;
        .el-button {
          margin-left: 5px;
        }
      }
    }
  }
  .bottom {
    width: 100%;
    height: 70px;
    box-sizing: border-box;
    border-top: 1px solid #d5deed;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
</style>
